<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('record/index')}">所有积分记录</a></li>
		<li class="active"><a href="{:url('record/add')}">添加积分记录</a></li>
	</ul>
	<form class="form-horizontal js-ajax-form margin-top-20" action="{:url('record/addTwo')}" method="post">
		<div clas s="form-group">
			<label class="col-sm-2 control-label"><span class="form-required"></span>积分截图</label>
			<input id="photo-1" type="hidden" name="image" >
			<input id="photo-1-name" type="text" name="photo_name" title="图片名称">
			<a href="javascript:uploadOneImage('图片上传','#photo-1');" id="picture">上传</a>
			<img id="photo-1-preview" width="150px">
		</div>
		<!--<div>
			<label class="col-sm-2 control-label">预览</label>
			<div class="col-md-6 col-sm-10">
				<img style="width:50px;height: 50px;" id="prew">
			</div>
		</div>
		<input type="hidden" name="picture" id="pic_path">-->
		<div class="form-group">
			<label class="col-sm-2 control-label">所属学校</label>
			<div class="col-md-6 col-sm-10">
				<select name="" id="selectSchool" class="form-control">
					<option value="">请选择学校</option>
					<volist name="school" id="vo">
						<option value="{$vo.id}">{$vo.name}</option>
					</volist>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">所属班级</label>
			<div class="col-md-6 col-sm-10">
				<select name="" id="selectRoom" class="form-control">
					<option value="">请选择班级</option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">学生姓名</label>
			<div class="col-md-6 col-sm-10">
				<select name="student_id" id="student_id" class="form-control">
					<option value="0">请选择学生</option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">原因选择</label>
			<div class="col-md-6 col-sm-10">
				<select name="reason_id" id="reason_id" class="form-control">
					<option value="">请选择原因</option>
					<volist name="reason" id="vo">
						<option value="{$vo.id}">{$vo.name}</option>
					</volist>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">积分变动</label>
			<div class="col-md-6 col-sm-10">
				<select name="score_id" id="score_id" class="form-control">
					<option value="">请选择积分</option>
					<volist name="score" id="vo">
						<option value="{$vo.id}">{$vo.name}</option>
					</volist>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">操作员名称:</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" id="input-name" readonly="true" name="user_id" value="{$user_name}" required="" lay-verify="name" class="layui-input" lay-verify="required">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
				<a class="btn btn-default" href="{:url('admin/record/index')}">{:lang('BACK')}</a>
			</div>
		</div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/layui/layui.all.js"></script>
<script>
    /*//使用ajax 将所选的文件异步发送给PHP导入方法
    layui.use('upload',function () {
        var upload = layui.upload;
        var uploadInst = upload.render({
            elem: '#picture'
            ,url: "{:url('record/addPost')}",
            accept: 'file'
            ,done: function (res) {
                //展示导入结果
                layer.msg(1);
            }
        });
    });*/
</script>
<script>
    $(function () {
        $('#selectSchool').change('click',function () {
            var schoolId=$('#selectSchool').val();
            $.ajax({
                url:"{:url('record/getRoom')}",
                type:"POST",
                data:{school_id:schoolId},
                success:function (res) {
                    console.log(res);
                    $('#selectRoom').html(res);
                }
            });
        });
    })
</script>
<script>
    $(function () {
        $('#selectRoom').change('click',function () {
            var roomId=$('#selectRoom').val();
            $.ajax({
                url:"{:url('record/getStudent')}",
                type:"POST",
                data:{room_id:roomId},
                success:function (res) {
                    console.log(res);
                    $('#student_id').html(res);
                }
            });
        });
    })
</script>
</body>
</html>